//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//
//
#ifndef Green_BntNodeManager_H
#define Green_BntNodeManager_H

#include <vector>

#include "Defines.h"
#include "Object.h"

namespace Green {

  class BntNode;

  /*!
    \class BntNodeManager
    \brief class to manage all bnt nodes.
  */

  class BntNodeManager : public Object {
  public:
    BntNodeManager() : Object(), mBntNodes(), mpHotSpeculativeBntNode(nullptr), mSpeculativeBntNodes() { } //!< Default Constructor
    Object* Clone() const override; //!< Return a cloned object of the same type and same contents of the object.
    const std::string ToString() const override; //!< Return a string describing the current state of the object.
    const char* Type() const override; //!< Return a string describing the actual type of the Object
    ~BntNodeManager(); //!< Destructor

    void SaveBntNode(BntNode* pBntNode); //!< Save Bnt node to the lists
    void SwapBntNodes(std::vector<BntNode*>& rSwapVec); //!< swap Bnt nodes
    BntNode* GetHotSpeculativeBntNode() const { return mpHotSpeculativeBntNode; } //!< get hot speculative Bnt node
    void PopSpeculativeBntNode(); //!< pop speculative Bnt node from the stack and set to be hot.

    ASSIGNMENT_OPERATOR_ABSENT(BntNodeManager);
  protected:
    BntNodeManager(const BntNodeManager& rOther); //!< Copy constructor
  protected:
    std::vector<BntNode* > mBntNodes; //!< container for non-speculative Bnt nodes
    BntNode* mpHotSpeculativeBntNode; //!< hot speculative Bnt node
    std::vector<BntNode* > mSpeculativeBntNodes; //!< the container for history speculative Bnt nodes
  };

}

#endif
